package com.fengxu.netty.tcp.protocol;

import java.io.Serializable;
import java.nio.charset.Charset;

// 自定义消息协议包
public class MessageProtocol implements Serializable {

    private static final long serialVersionUID = 1L;

    // 数据包长度
    private int len;
    // 数据包具体的字节数组
    private byte[] content;

    public int getLen() {
        return len;
    }

    public MessageProtocol setLen(int len) {
        this.len = len;
        return this;
    }

    public byte[] getContent() {
        return content;
    }

    public MessageProtocol setContent(byte[] content) {
        this.content = content;
        return this;
    }

    @Override
    public String toString() {
        return "MessageProtocol{" +
                "len=" + len +
                ", content=" + new String(content, Charset.forName("utf-8")) +
                '}';
    }
}
